@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  font-weight: 400;

  color-scheme: light dark;
  color: rgba(255, 255, 255, 0.87);
  background-color: #242424;

  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

a {
  font-weight: 500;
  color: #646cff;
  text-decoration: inherit;
}
a:hover {
  color: #535bf2;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background-color: #121212;
  color: white;
}

h1 {
  font-size: 3.2em;
  line-height: 1.1;
}

button {
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0.6em 1.2em;
  font-size: 1em;
  font-weight: 500;
  font-family: inherit;
  background-color: #1a1a1a;
  cursor: pointer;
  transition: border-color 0.25s;
}
button:hover {
  border-color: #646cff;
}
button:focus,
button:focus-visible {
  outline: 4px auto -webkit-focus-ring-color;
}

@media (prefers-color-scheme: light) {
  :root {
    color: #213547;
    background-color: #ffffff;
  }
  a:hover {
    color: #747bff;
  }
  button {
    background-color: #f9f9f9;
  }
}

/* Hide scrollbar for Chrome, Safari and Opera */
.hide-scrollbar::-webkit-scrollbar {
  display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.hide-scrollbar {
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

/* 自定义弹窗动画 */
@keyframes fadeIn {
  0% { opacity: 0; transform: translateY(-30px); }
  50% { opacity: 1; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fadeIn 0.5s ease-out forwards;
}

/* 添加移动端视口高度修复 */
@supports (-webkit-touch-callout: none) {
  .h-screen {
    height: -webkit-fill-available;
  }
  
  body, html {
    height: 100%;
    overflow: auto;
    position: fixed;
    width: 100%;
    overscroll-behavior: none;
  }
}

/* 添加安全区域内边距处理 */
.safe-area-padding-bottom {
  padding-bottom: env(safe-area-inset-bottom, 12px);
}

/* 全局滚动条样式 */
.scrollbar-none {
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

.scrollbar-none::-webkit-scrollbar {
  display: none;  /* Chrome, Safari and Opera */
}

/* 确保body和html可以正常滚动 */
html, body {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

/* 移动设备触摸滚动优化 */
* {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* 头像加载样式 */
.avatar-container {
  position: relative;
  width: 2rem; /* w-8 */
  height: 2rem; /* h-8 */
  border-radius: 9999px; /* rounded-full */
  overflow: hidden;
  background-color: #333;
  flex-shrink: 0;
}

.avatar-container::before {
  content: '';
  position: absolute;
  inset: 0;
  background-color: #333;
  z-index: 0;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0% { opacity: 0.5; }
  50% { opacity: 0.7; }
  100% { opacity: 0.5; }
}

.avatar-container img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 0%;
  transition: opacity 0.3s ease-in-out;
}

/* 避免图片变形的通用样式 */
img.prevent-distort {
  opacity: 0;
}

img.prevent-distort.loaded {
  opacity: 1;
}

/* 添加头像边框渐变效果 */
.avatar-border {
  border: 1px solid transparent;
  background-image: linear-gradient(to right, #1e1e1e, #1e1e1e), 
                    linear-gradient(to right, rgba(255, 55, 95, 0.7), rgba(255, 155, 55, 0.7));
  background-origin: border-box;
  background-clip: padding-box, border-box;
}
